import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Scanner;

public class Hash {
    public static void main(String[] args) {
        HashTable TestTable=new HashTable();
        try {
            BufferedReader BR = new BufferedReader(new InputStreamReader(new FileInputStream("1.txt"),("Windows-1251")));
            String s;
            while((s = BR.readLine())!= null) {
                    for(int i = 0; i < s.length(); i++) {
                        char c=s.charAt(i);
                        if (c=='.' || c==',' || c=='!' || c=='?' ||
                                c==')' || c=='(' || c==':' ||
                                c==';' || c=='!' || c=='"' || 
                                c=='\'' || c=='«' ||c=='»') {
                            s = s.substring(0, i) + s.substring(i+1);
                            i--;
                        }
                    }
                    Scanner Sc = new Scanner(s);
                    while(Sc.hasNext()) TestTable.add(Sc.next().toUpperCase());
            }
        }
        catch(Exception e) {};
        int S=0;
        for (int i=0;i<TestTable.Tab.length;i++) if (TestTable.Tab[i]!=null) S+=TestTable.Tab[i].size()-1;
        System.out.println(S);
    }
}

class HashTable {
    public LinkedList<Pair>[] Tab;
    private int C;
    
    public HashTable() {
        Tab=new LinkedList[2];
        C=0;
    }
    
    public int hash(String s, int L) {
        int hash = 0; 
        for(int i = 0; i < s.length(); i++) hash = (35 * hash + s.charAt(i)) % L;
        return hash;       
        /*          int hash = 0;
         for(int i = 0; i < s.length(); i++){
             hash = Math.abs(35 * hash + s.charAt(i)-555) % L;
         }
         return hash;  */
        /*return Math.abs(s.hashCode())%L;*/
    }
    
    private void AWR(String s) {
        LinkedList<Pair>[] Tab2=new LinkedList[2*Tab.length];
        for (int i=0;i<Tab.length;i++) if (Tab[i]!=null) {
            ListIterator<Pair> j=Tab[i].listIterator();
            while (j.hasNext()) {
                Pair t=j.next();
                int m=hash(t.key,Tab2.length);
                if (Tab2[m]==null) Tab2[m]=new LinkedList<Pair>();
                Tab2[m].add(t);
            }
        }
        Tab=Tab2;
        int m=hash(s,Tab.length);
        if (Tab[m]==null) Tab[m]=new LinkedList<Pair>();
        Tab[m].add(new Pair(s));
        C++;
    }
    
    public void add(String s) {
        int m=hash(s,Tab.length);
        if (Tab[m]==null) {
            if (2*C<Tab.length) {
                Tab[m]=new LinkedList<Pair>();
                Tab[m].add(new Pair(s));
                C++;
            }
            else AWR(s);
        }
        else {
            ListIterator<Pair> i=Tab[m].listIterator();
            while (i.hasNext()) {
                Pair t=i.next();
                if (t.key.equals(s)) {
                    t.value++;
                    return;
                }
            }
            if (2*C<Tab.length) {
                Tab[m].add(new Pair(s));
                C++;
            }
            else AWR(s);
        }
    }
    
    public int get(String s) {
        int m=hash(s,Tab.length);
        if (Tab[m]==null) return 0;
        else {
            ListIterator<Pair> i=Tab[m].listIterator();
            while (i.hasNext()) {
                Pair t=i.next();
                if (t.key.equals(s)) return t.value;
            }
            return 0;
        }
    }
}

class Pair {
    public String key;
    public int value;
    
    public Pair(String key) {
        this.key=key;
        value=1;
    }
}